package tk.mybatis.springboot.util;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;

public class ClientIoHandler extends IoHandlerAdapter {

    @Override
    public void sessionOpened(IoSession session) throws Exception {
        System.out.println("创建 session 连接");
    }

    @Override
    public void sessionClosed(IoSession iosession) throws Exception {
        System.out.println("会话连接关闭");
        iosession.close(true);
    }

    @Override
    public void messageReceived(IoSession iosession, Object obj) throws Exception {
        // 接收到响应消息 你可以根据实际需求进一步处理和响应消息
        String message = (String) obj;
        System.out.println("客户端成功接收到消息:" + message);
    }

}
